using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace EFDataBase.Models.Mapping
{
    public class Product_attributesMap : EntityTypeConfiguration<Product_attributes>
    {
        public Product_attributesMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.id)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.product_id)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.product_type)
                .HasMaxLength(50);

            this.Property(t => t.product_detale)
                .HasMaxLength(550);

            this.Property(t => t.main_img)
                .HasMaxLength(150);

            this.Property(t => t.childimg)
                .HasMaxLength(150);

            this.Property(t => t.Stock)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.Sales_volume)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.price)
                .IsFixedLength()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("Product_attributes");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.product_id).HasColumnName("product_id");
            this.Property(t => t.product_type).HasColumnName("product_type");
            this.Property(t => t.product_detale).HasColumnName("product_detale");
            this.Property(t => t.main_img).HasColumnName("main_img");
            this.Property(t => t.childimg).HasColumnName("childimg");
            this.Property(t => t.Stock).HasColumnName("Stock");
            this.Property(t => t.Sales_volume).HasColumnName("Sales_volume");
            this.Property(t => t.price).HasColumnName("price");
        }
    }
}
